package com.impzx.restaurant.rest.service;

import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;

import org.springframework.beans.factory.annotation.Autowired;

import com.zxpan.restaurant.db.model.User;
import com.zxpan.restaurant.persist.dao.UserDao;

@Path("/user")
public class UserService {

	@Autowired
	private UserDao userDao;
	
	@POST
	@Path("addUser")
	public String addUser(@FormParam("name") String name, @FormParam("password") String password) {
		User user = new User();
		user.setName(name);
		user.setPassword(name);
		int result = userDao.addUser(user);
		if(result == 1) {
			return "add user success";
		} else {
			return "add user error";
		}
	}
	
	@GET
	@Path("getUser")
	public String getUser() {
		return "test";
	}
}
